#define DEBUG
#include <cstdio>
#include <cstring>

using namespace std;

const int maxn=50, maxl=20, mods=990804011;

long long solve(int o, int p, int n, char s[][maxl+1]) {
  if (o<=n) {
    if (s[o][p]=='?') {
      long long ret=0;
      for (int i=0; i<26; i++) {
	s[o][p] = 'a'+i;
	ret = (ret+(s[o][p]=='\0' ? solve(o+1, 0, n, s) : solve(o, p+1, n, s)))%mods;
      }
      s[o][p] = '?';
      return ret;
    } else {
      return s[o][p]=='\0' ? solve(o+1, 0, n, s) : solve(o, p+1, n, s);
    }
  } else {
    for (int i=1; i<n; i++) {
      if (strcmp(s[i], s[i+1])>=0) {
	return 0;
      }
    }
    return 1;
  }
}

int main() {
  freopen("b.in", "r", stdin);
  freopen("b.out", "w", stdout);

  char s[maxn+1][maxl+1];
  int n;
  scanf("%d", &n);
  for (int i=1; i<=n; i++) {
    scanf("%s", s[i]);
  }

  printf("%lld", solve(1, 0, n, s));

  fclose(stdin);
  fclose(stdout);
  return 0;
}
